/*
*  Copyright 2019-2020 Liu
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package com.liu.modules.business.domain;

import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.persistence.*;
import javax.validation.constraints.*;
import java.sql.Timestamp;
import java.io.Serializable;

/**
* @website https://el-admin.vip
* @description /
* @author Liu
* @date 2022-07-03
**/
@Entity
@Data
@Table(name="novel_info")
public class NovelInfo implements Serializable {

    @Id
    @Column(name = "id")
    @ApiModelProperty(value = "名称+作者生成的MD5")
    private String id;

    @Column(name = "fenlei_id")
    @ApiModelProperty(value = "类别")
    private String fenleiId;

    @Column(name = "novel_pic_url")
    @ApiModelProperty(value = "小说图片链接")
    private String novelPicUrl;

    @Column(name = "novel_name")
    @ApiModelProperty(value = "名称")
    private String novelName;

    @Column(name = "novel_author")
    @ApiModelProperty(value = "作者")
    private String novelAuthor;

    @Column(name = "novel_type")
    @ApiModelProperty(value = "类型")
    private String novelType;

    @Column(name = "novel_state")
    @ApiModelProperty(value = "状态")
    private String novelState;

    @Column(name = "new_chapter")
    @ApiModelProperty(value = "最新章节")
    private String newChapter;

    @Column(name = "novel_intro")
    @ApiModelProperty(value = "简介")
    private String novelIntro;

    @Column(name = "novel_url")
    @ApiModelProperty(value = "详情")
    private String novelUrl;

    @Column(name = "novel_detail_url")
    @ApiModelProperty(value = "目录")
    private String novelDetailUrl;

    @Column(name = "create_time")
    @ApiModelProperty(value = "创建时间")
    private Timestamp createTime;

    @Column(name = "update_time")
    @ApiModelProperty(value = "更新时间")
    private Timestamp updateTime;

    public void copy(NovelInfo source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}